home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar Extras 3
/
Ex3side2.d64
/
loader src.sda
/
LOADER.SRC
< prev
next >
Wrap
Text File
|
2022-08-28
|
21KB
|
2,076 lines
;*** LOADER
open =$ffc0
cint =$ff81
readst =$ffb7
setlfs =$ffba
setnam =$ffbd
setmsg =$ff90
load =$ffd5
getin =$ffe4
input'buffer =512
clrchn =$ffcc
close =$ffc3 ;a
chrin =$ffcf
chkout =$ffc9 ;x
chkin =$ffc6 ;x
plot =$fff0
chrout =$ffd2
color'pointer =243
screen'line'pointer =209
print'number =$bdcd ;x,a
clear'line =59903
background =53281
border =53280
strout = $ab1e; .A low .Y high
unlisten =$ffae
clall =$ffe7
color1 =53282
color2 =53283
color3 =53284
white =5
crsr'down =17
rvs'on =18
home =19
del =20
red =28
crsr'right =29
green =30
blue =31
black =144
lowercase =14
uppercase =142
crsr'up =145
rvs'off =146
clr =147
insert =148
brown =149
light'red =150
dark'grey =151
medium'grey =152
light'green =153
light'blue =154
light'grey =155
purple =156
crsr'left =157
yellow =158
cyan =159
top'left =176
top'right =174
bottom'left =173
bottom'right =189
.org $0801
.obj "@0:loader"
;mem
.byte $0b,$08,$0a,$00,$9e,$32,$30,$36
.byte $31,$00,$00,$00
lda #8
jsr chrout
lda #4
sta 648
jsr cint
lda 56578
ora #3
sta 56578
lda 56576
and #252
ora #3
sta 56576
lda #27
sta 53265
lda 53270
and #239
sta 53270
lda #0
sta 53281
ldx #0
- stx 53280
inx
bne -
stx 53280
lda #119
sta 787
lda #0
sta partition'mode
artstay lda 186
cmp #8
bcs +
lda #8
+ cmp #30
bcc +
lda #8
+ sta device
sta boot'device
jsr poll'devices
lda boot'device
sta 186
lda 787
cmp #119
beq ++
device'crap ldx boot'device
lda devices,x
beq +
jsr find'device
jsr make'screen
lda devices
cmp #2
bcc +
lda #255
sta partition'mode
jsr device'menu
reentry =*
+ lda #0
sta n'files
sta n'files+1
+ jsr get'files
lda init'results
bne device'crap
lda n'files
ora n'files+1
bne +
ldx <nothing'prompt
ldy >nothing'prompt
jsr do'message
lda #0
sta 198
- jsr getin
beq -
jmp device'crap
+ jmp file'menu
rts
get'files lda #0
sta init'results
sta 787
lda partition'mode
beq +
jmp get'partitions
+ lda #15
jsr close
lda #1
ldx <init
ldy >init
jsr setnam
lda #15
ldx device
ldy #15
jsr setlfs
jsr open
jsr clrchn
ldx #15
jsr chkin
ldy #0
- jsr getin
cmp #13
beq +
sta error'buffer,y
iny
bne -
+ lda #0
sta error'buffer,y
jsr clrchn
lda error'buffer
ora error'buffer+1
cmp "0"
beq +
error'init ldx <error'buffer
ldy >error'buffer
jsr do'message
lda #15
jsr close
lda #0
sta 198
sta n'files
- jsr getin
beq -
rts
+ lda #34
ldx <dir'name
ldy >dir'name
jsr setnam
lda #2
ldx device
ldy #0
jsr setlfs
jsr open
jsr clrchn
ldx #2
jsr chkin
ldx <$d000
stx 251
ldy >$d000
sty 252
ldy #0
jsr getin
jsr getin
- ldy #0
jsr getin
jsr rom'out
sta (251),y
jsr rom'in
jsr bump'251
jsr readst
and #66
sta eof
beq -
lda #2
jsr close
jsr clrchn
ldy #0
tya
jsr rom'out
sta (251),y
jsr rom'in
lda 251
sec
sbc <$d000
sta n'files
lda 252
sbc >$d000
sta n'files+1
ldx #4
- lsr n'files+1
ror n'files
dex
bpl -
lda n'files
sec
sbc #1
sta n'files
lda n'files+1
sbc #0
sta n'files+1
rts
get'partitions jsr wipe'mem
lda #255
sta partition'mode
lda #15
jsr close
lda #1
ldx <init
ldy >init
jsr setnam
lda #15
ldx device
ldy #15
jsr setlfs
jsr open
jsr clrchn
ldx #15
jsr chkin
ldy #0
- jsr getin
cmp #13
beq +
sta error'buffer,y
iny
bne -
+ lda #0
sta error'buffer,y
jsr clrchn
lda error'buffer
ora error'buffer+1
cmp "0"
beq +
lda #255
sta init'results
jmp error'init
+ lda #15
jsr close
lda #2
ldx <pinit
ldy >pinit
jsr setnam
lda #15
ldx device
ldy #15
jsr setlfs
jsr open
jsr clrchn
ldx #15
jsr chkin
ldy #0
- jsr getin
cmp #13
beq +
sta error'buffer,y
iny
bne -
+ lda #0
sta error'buffer,y
jsr clrchn
lda error'buffer
cmp "0"
bne +
lda error'buffer+1
cmp "2"
bne +
jmp ++
+ lda #0
sta partition'mode
jmp get'files
+ jsr clrchn
ldx <part'mess
ldy >part'mess
jsr do'message
lda #3
ldx <part'dir'name
ldy >part'dir'name
jsr setnam
lda #2
ldx device
ldy #0
jsr setlfs
jsr open
jsr clrchn
ldx #15
jsr chkin
ldy #0
- jsr getin
cmp #13
beq +
sta error'buffer,y
iny
bne -
+ lda #0
sta error'buffer,y
jsr clrchn
lda error'buffer
ora error'buffer+1
cmp "0"
beq +
lda #0
sta partition'mode
jmp get'files
+ jsr clrchn
ldx #2
jsr chkin
ldx <$d000-32
stx 251
ldy >$d000-32
sty 252
ldy #0
jsr getin
jsr getin
- ldy #0
jsr getin
jsr rom'out
sta (251),y
jsr rom'in
jsr bump'251
jsr readst
and #66
sta eof
beq -
lda #2
jsr close
jsr clrchn
ldy #0
tya
jsr rom'out
sta (251),y
jsr rom'in
lda 251
sec
sbc <40960-32
sta n'files
lda 252
sbc >40960-32
sta n'files+1
ldx #4
- lsr n'files+1
ror n'files
dex
bpl -
lda n'files
sec
sbc #2
sta n'files
lda n'files+1
sbc #0
sta n'files+1
lda n'files+1
bne +
lda n'files
cmp #2
bcs +
lda #0
sta n'files
sta n'files+1
lda #0
sta partition'mode
jmp get'files
+ rts
;ldx n'files
;lda n'files+1
;jmp $bdcd
index'file lda file
sta 253
lda file+1
sta 254
ldx #4
- asl 253
rol 254
dex
bpl -
lda <$d000
clc
adc 253
sta 253
lda >$d000
adc 254
sta 254
ldy #31
jsr rom'out
- lda (253),y
sta file'buffer,y
dey
bpl -
jmp rom'in
print'file ldx file'buffer
lda file'buffer+1
jsr print'number
ldy #2
- lda file'buffer,y
jsr chrout
iny
cmp #34
bne -
sty typeloc
lda file'buffer,y
cmp "h"
beq +
iny
iny
/ lda file'buffer,y
jsr chrout
cmp #34
beq dotype
iny
bne -
dotype lda #25
sta 211
jsr 58732
ldy typeloc
lda file'buffer,y
cmp "r"
beq it'syum
cmp "h"
beq it'sconnect
cmp "b"
beq it'sboot
cmp "t"
beq it'stext
cmp "p"
beq it'spacked
it'syum lda <rtype
ldy >rtype
jmp strout
it'sconnect lda <htype
ldy >htype
jmp strout
it'sboot lda <btype
ldy >btype
jmp strout
it'stext lda <ttype
ldy >ttype
jmp strout
it'spacked lda <ptype
ldy >ptype
jmp strout
print'part ldx file'buffer
lda file'buffer+1
jsr print'number
ldy #2
- lda file'buffer,y
jsr chrout
iny
cpy #32
bne -
rts
make'screen lda #26
sta 53272
lda #0
sta 53281
lda #6
sta 53280
ldx <frame1
ldy >frame1
jsr do'frame
ldx <box1
ldy >box1
jsr do'box
ldx <box2
ldy >box2
jsr do'box
ldx <box3
ldy >box3
jsr do'box
ldx <box4
ldy >box4
jsr do'box
ldx <box5
ldy >box5
jsr do'box
ldx <box6
ldy >box6
jsr do'box
ldx <frame2
ldy >frame2
jsr do'frame
ldx <box7
ldy >box7
lda #96
sta box7+4
lda #5
sta box7+5
jsr do'box
jsr fade'in
ldx <box7
ldy >box7
lda #95
sta box7+4
lda #3
sta box7+5
jsr do'box
ldx <box8
ldy >box8
jsr do'box
optimize sta 53374 ;way doown here to
sta 53366;give the vic chip time after
sta 53375; changing font
lda frame1+4
sta 646
lda #0
sta 199
ldy #0
ldx #2
clc
jsr plot
lda #171
jsr chrout
ldy #39
ldx #2
clc
jsr plot
lda #179
jsr chrout
jsr linx
ldy #0
ldx #22
clc
jsr plot
lda #171
jsr chrout
ldy #39
ldx #22
clc
jsr plot
lda #179
jsr chrout
jsr linx
lda #19
jsr chrout
;ldy #0
;- lda info,y
;beq +
;ora #128
;sta 1947,y
;iny
;bne -
ldy #0
- lda info2,y
beq +
ora #128
sta 1024+40+3,y
iny
bne -
+ rts
poll'devices lda #0
sta devices
lda #8
sta temp
- lda temp
tax
cmp #14
beq +
lda #0
sta devices,x
lda #0
tax
tay
jsr setnam
lda #2
ldx temp
tay
jsr setlfs
jsr open
lda #2
jsr close
jsr readst
bmi +
ldx temp
txa
sta devices,x
inc devices
+ inc temp
lda temp
cmp #30
bcc -
rts
fade'out lda #255
ldy #7
- sta 96*8+font,y
dey
bpl -
ldx #63
lda <fade'data
sta 251
lda >fade'data
sta 252
- ldy #7
- lda (251),y
sta shift'space,y
dey
bpl -
lda #8
clc
adc 251
sta 251
lda #0
adc 252
sta 252
dex
bpl --
rts
fade'in lda #0
ldy #7
- sta 96*8+font,y
dey
bpl -
ldx #64
lda <64*8+fade'data
sta 251
lda >64*8+fade'data
sta 252
- ldy #7
- lda (251),y
sta shift'space,y
dey
bpl -
- lda 53265
bpl -
lda 251
sec
sbc #8
sta 251
lda 252
sbc #0
sta 252
dex
bpl ---
rts
find'device inx
- lda devices,x
bne +
inx
cpx #31
bne -
ldx #8
+ stx device
rts
device'menu lda #4
sta parms
lda #9
sta parms+1
lda #5
sta parms+2
lda #8
clc
adc devices
sta parms+3
lda #255
sta parms+4
lda #5
sta parms+5
ldx <parms
ldy >parms
jsr do'box
inc parms
inc parms+1
dec parms+2
dec parms+3
lda #7
sta parms+4
ldx <parms
ldy >parms
jsr do'frame
inc parms
dec parms+1
inc parms+2
dec parms+3
lda #96
sta parms+4
lda #3
sta parms+5
ldx <parms
ldy >parms
jsr do'box
jsr fade'in
lda #160
sta parms+4
ldx <parms
ldy >parms
jsr do'box
print'devices lda parms+5
sta 646
lda #1
sta 199
ldy parms
iny
ldx parms+2
inx
clc
jsr plot
ldx #8
ldy #0
- lda devices,x
bne +
inx
cpx #30
bcc -
jmp ++
+ cpx #10
bcs no0
lda "0"
jsr chrout
no0 txa
sta device'array,y
iny
sty temp
pha
lda #0
jsr print'number
ldx 214
inx
ldy parms
iny
c